<?php

/**
 * @author 陈韵
 * 余外-火凤凰创建订单
 */
namespace App\Service\OrderService\OrderRouteService;
use App\Service\Code\Normal;
use App\Service\OrderService\BaseSupplierRouterService;
use App\Service\VendorClient\Shophuofenghuang\ShophuofenghuangApiClient;
use App\Service\TraitService\SupplierRouterOrderTrait;

class Shophuofenghuang extends BaseSupplierRouterService
{
    use SupplierRouterOrderTrait;
    
    /**
     * 订单申报
     * @param array $param
     * @return mixed
     */
    public function orderPay( $param = [] )
    {
        if(isset($param["apiBody"]["noPushTimeStart"]) && $param["apiBody"]["noPushTimeEnd"]){
             //获取当前时间;
             $time = time();
             $noPushTimeStart = $param["apiBody"]["noPushTimeStart"];
             $noPushTimeEnd   = $param["apiBody"]["noPushTimeEnd"];
             //在设置的时间段内，禁止推单
             if($time >= strtotime($noPushTimeStart) && $time <= strtotime($noPushTimeEnd)){
                 return Normal::returnCode(Normal::FAIL,"{$noPushTimeStart} 至 {$noPushTimeEnd} 时间段内，禁止向火凤凰仓推单！");
             }
        }
        return $this->callSdkApi(ShophuofenghuangApiClient::class,$param['apiBody'])->createOrder($param);
    }

    /**
     * 订单取消
     * @param array $param
     * @return mixed
     */
    public function orderCancel( $param = [] )
    {
        return Normal::returnCode(Normal::SUC,"处理完成");
    }
    
    /**
     * 订单售后
     * @param array $param
     * @return mixed
     */
    public function orderAfterSale($param = [])
    {
        return $this->callSdkApi(ShophuofenghuangApiClient::class,$param['apiBody'])->cancelOrder($param);
    }
    
    /**
     * 获取物流信息
     * @param array $param
     */
    public function orderExpress( $param = [] )
    {
        return Normal::returnCode(Normal::SUC,"处理完成");
    }

    /**
     * 商品列表查询接口
     * @param array $param
     * @return mixed
     */
    public function queryGoodsList( $param = [] )
    {
        return Normal::returnCode(Normal::SUC,"处理完成");
    }
}